{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "spam\n",
      "============\n",
      "Hello world!\n"
     ]
    }
   ],
   "source": [
    "class SpecialString:\n",
    "    def __init__(self,cont):\n",
    "        self.cont = cont\n",
    "        \n",
    "    def __truediv__(self,other):\n",
    "        line = \"=\" * len(other.cont)\n",
    "        return \"\\n\".join([self.cont,line,other.cont])\n",
    "spam = SpecialString(\"spam\")\n",
    "hello = SpecialString(\"Hello world!\")\n",
    "print(spam/hello)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "person\n"
     ]
    }
   ],
   "source": [
    "class Person:   #定义一个人类\n",
    "    role = 'person'  #人的角色属性都是人\n",
    "    def __init__(self,name):\n",
    "        self.name = name  # 每一个角色都有自己的昵称;\n",
    "        \n",
    "    def walk(self):  #人都可以走路，也就是有一个走路方法\n",
    "        print(\"person is walking...\")\n",
    "\n",
    "\n",
    "print(Person.role)  #查看人的role属性\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<function Person.walk at 0x000002035D84D6A8>\n"
     ]
    }
   ],
   "source": [
    "print(Person.walk) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<script type=\"text/javascript\">window.PlotlyConfig = {MathJaxConfig: 'local'};</script><script type=\"text/javascript\">if (window.MathJax) {MathJax.Hub.Config({SVG: {font: \"STIX-Web\"}});}</script><script>requirejs.config({paths: { 'plotly': ['https://cdn.plot.ly/plotly-latest.min']},});if(!window._Plotly) {require(['plotly'],function(plotly) {window._Plotly=plotly;});}</script>"
      ],
      "text/vnd.plotly.v1+html": [
       "<script type=\"text/javascript\">window.PlotlyConfig = {MathJaxConfig: 'local'};</script><script type=\"text/javascript\">if (window.MathJax) {MathJax.Hub.Config({SVG: {font: \"STIX-Web\"}});}</script><script>requirejs.config({paths: { 'plotly': ['https://cdn.plot.ly/plotly-latest.min']},});if(!window._Plotly) {require(['plotly'],function(plotly) {window._Plotly=plotly;});}</script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "linkText": "Export to plot.ly",
        "plotlyServerURL": "https://plot.ly",
        "showLink": false
       },
       "data": [
        {
         "type": "scatter",
         "uid": "8ed65815-0036-4732-a497-b3c580981f05",
         "x": [
          1,
          2
         ],
         "y": [
          1,
          2
         ]
        },
        {
         "type": "scatter",
         "uid": "c74a090f-3ba3-4f68-bfcd-7399e092cf33",
         "x": [
          1,
          2
         ],
         "y": [
          2,
          1
         ]
        }
       ],
       "layout": {}
      },
      "text/html": [
       "<div id=\"58069b65-01e0-49e1-9e8a-adfc1a8d8ac4\" style=\"height: 525px; width: 100%;\" class=\"plotly-graph-div\"></div><script type=\"text/javascript\">require([\"plotly\"], function(Plotly) { window.PLOTLYENV=window.PLOTLYENV || {};window.PLOTLYENV.BASE_URL=\"https://plot.ly\";Plotly.newPlot(\"58069b65-01e0-49e1-9e8a-adfc1a8d8ac4\", [{\"x\": [1, 2], \"y\": [1, 2], \"type\": \"scatter\", \"uid\": \"2b12a28b-fbb0-4187-b4f3-0d2560ea29cf\"}, {\"x\": [1, 2], \"y\": [2, 1], \"type\": \"scatter\", \"uid\": \"09178748-74b9-4077-9bb6-1be0acfb85a6\"}], {}, {\"showLink\": false, \"linkText\": \"Export to plot.ly\", \"plotlyServerURL\": \"https://plot.ly\"})});</script><script type=\"text/javascript\">window.addEventListener(\"resize\", function(){window._Plotly.Plots.resize(document.getElementById(\"58069b65-01e0-49e1-9e8a-adfc1a8d8ac4\"));});</script>"
      ],
      "text/vnd.plotly.v1+html": [
       "<div id=\"58069b65-01e0-49e1-9e8a-adfc1a8d8ac4\" style=\"height: 525px; width: 100%;\" class=\"plotly-graph-div\"></div><script type=\"text/javascript\">require([\"plotly\"], function(Plotly) { window.PLOTLYENV=window.PLOTLYENV || {};window.PLOTLYENV.BASE_URL=\"https://plot.ly\";Plotly.newPlot(\"58069b65-01e0-49e1-9e8a-adfc1a8d8ac4\", [{\"x\": [1, 2], \"y\": [1, 2], \"type\": \"scatter\", \"uid\": \"2b12a28b-fbb0-4187-b4f3-0d2560ea29cf\"}, {\"x\": [1, 2], \"y\": [2, 1], \"type\": \"scatter\", \"uid\": \"09178748-74b9-4077-9bb6-1be0acfb85a6\"}], {}, {\"showLink\": false, \"linkText\": \"Export to plot.ly\", \"plotlyServerURL\": \"https://plot.ly\"})});</script><script type=\"text/javascript\">window.addEventListener(\"resize\", function(){window._Plotly.Plots.resize(document.getElementById(\"58069b65-01e0-49e1-9e8a-adfc1a8d8ac4\"));});</script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "\n",
    "import plotly.offline as py\n",
    "from plotly.graph_objs import Scatter, Layout\n",
    "import plotly.graph_objs as go\n",
    " \n",
    "py.init_notebook_mode(connected=True)\n",
    " \n",
    "trace1=go.Scatter(\n",
    "    x=[1,2],\n",
    "    y=[1,2]\n",
    ")\n",
    "trace2=go.Scatter(\n",
    "    x=[1,2],\n",
    "    y=[2,1]\n",
    ")\n",
    "py.iplot([trace1, trace2])\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "linkText": "Export to plot.ly",
        "plotlyServerURL": "https://plot.ly",
        "showLink": false
       },
       "data": [
        {
         "marker": {
          "color": [
           "red",
           "blue",
           "green"
          ],
          "size": [
           30,
           80,
           200
          ]
         },
         "mode": "markers",
         "type": "scatter",
         "uid": "b2e561c1-1a6d-4ec7-8cea-ffc340e9fc51",
         "x": [
          1,
          2,
          3
         ],
         "y": [
          1,
          2,
          3
         ]
        }
       ],
       "layout": {}
      },
      "text/html": [
       "<div id=\"7b38f3ed-fc04-4fd3-9c5c-041d3a2353c8\" style=\"height: 525px; width: 100%;\" class=\"plotly-graph-div\"></div><script type=\"text/javascript\">require([\"plotly\"], function(Plotly) { window.PLOTLYENV=window.PLOTLYENV || {};window.PLOTLYENV.BASE_URL=\"https://plot.ly\";Plotly.newPlot(\"7b38f3ed-fc04-4fd3-9c5c-041d3a2353c8\", [{\"marker\": {\"color\": [\"red\", \"blue\", \"green\"], \"size\": [30, 80, 200]}, \"mode\": \"markers\", \"x\": [1, 2, 3], \"y\": [1, 2, 3], \"type\": \"scatter\", \"uid\": \"507fafa0-3de9-4875-9720-0ee3737273ec\"}], {}, {\"showLink\": false, \"linkText\": \"Export to plot.ly\", \"plotlyServerURL\": \"https://plot.ly\"})});</script><script type=\"text/javascript\">window.addEventListener(\"resize\", function(){window._Plotly.Plots.resize(document.getElementById(\"7b38f3ed-fc04-4fd3-9c5c-041d3a2353c8\"));});</script>"
      ],
      "text/vnd.plotly.v1+html": [
       "<div id=\"7b38f3ed-fc04-4fd3-9c5c-041d3a2353c8\" style=\"height: 525px; width: 100%;\" class=\"plotly-graph-div\"></div><script type=\"text/javascript\">require([\"plotly\"], function(Plotly) { window.PLOTLYENV=window.PLOTLYENV || {};window.PLOTLYENV.BASE_URL=\"https://plot.ly\";Plotly.newPlot(\"7b38f3ed-fc04-4fd3-9c5c-041d3a2353c8\", [{\"marker\": {\"color\": [\"red\", \"blue\", \"green\"], \"size\": [30, 80, 200]}, \"mode\": \"markers\", \"x\": [1, 2, 3], \"y\": [1, 2, 3], \"type\": \"scatter\", \"uid\": \"507fafa0-3de9-4875-9720-0ee3737273ec\"}], {}, {\"showLink\": false, \"linkText\": \"Export to plot.ly\", \"plotlyServerURL\": \"https://plot.ly\"})});</script><script type=\"text/javascript\">window.addEventListener(\"resize\", function(){window._Plotly.Plots.resize(document.getElementById(\"7b38f3ed-fc04-4fd3-9c5c-041d3a2353c8\"));});</script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "trace=go.Scatter(\n",
    "    x=[1,2,3],\n",
    "    y=[1,2,3],\n",
    "    marker=dict(\n",
    "        color=['red','blue','green'],\n",
    "        size=[30,80,200],\n",
    "    ),\n",
    "     mode='markers'\n",
    ")\n",
    "py.iplot([trace])\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python [conda root]",
   "language": "python",
   "name": "conda-root-py"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
